<?php defined('InShopNC') or exit('Access Invalid!');?>
<!--热销商品板块-->
<script type="text/javascript">
    var SHOP_SITE_URL = "<?php echo SHOP_SITE_URL; ?>";
    var UPLOAD_SITE_URL = "<?php echo UPLOAD_SITE_URL; ?>";
    var important_goods_max = 20;
</script>
<style>
    .home-templates-board-layout .goods-list01 {
        height: auto;
        width:100%!important;
    }
    .home-templates-board-layout {
        background: none;
        width:100%;
    }
    .home-templates-board-layout .middle01 {
        width: 98%;
    }
    .home-templates-board-layout .goods-list01 li {
        width: 175px;
    }
    dl[recommend_id] dt a:nth-child(4){
        display:none;
    }
    dl[recommend_id] dt a:nth-child(5){
        display:none;
    }
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back" href="index.php?act=web_config&op=new_web_config" title="返回<?php echo '板块区'; ?>列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3><?php echo $lang['web_config_index']; ?> - <?php echo $lang['web_config_web_edit']; ?>
                    “<?php echo $output['web_array']['web_name'] ?>”板块</h3>
                <h5><?php echo $lang['nc_web_index_subhead']; ?></h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="<?php echo $lang['nc_prompts_title'];?>"><?php echo $lang['nc_prompts'];?></h4>
            <span id="explanationZoom" title="<?php echo $lang['nc_prompts_span'];?>"></span> </div>
        <ul>
            <li><?php echo $lang['web_config_edit_help1'];?></li>
            <li>如果为空即读取销量最大的10个商品显示</li>
        </ul>
    </div>
    <div class="ncap-form-all">
        <dl class="row">
            <dt class="tit">
                <label><?php echo $lang['web_config_edit_html'].$lang['nc_colon'];?></label>
            </dt>
            <dd class="opt">
                <div class="home-templates-board-layout style-<?php echo $output['web_array']['style_name'];?>">
                    <div class="middle middle01">
                        <?php if (is_array($output['code_recommend_list']['code_info']) && !empty($output['code_recommend_list']['code_info'])) { ?>
                            <?php foreach ($output['code_recommend_list']['code_info'] as $key => $val) { ?>
                                <dl recommend_id="<?php echo $key;?>">
                                    <dt>
                                        <h4><?php echo $val['recommend']['name']; ?></h4>
                                        <a href="JavaScript:del_recommend(<?php echo $key;?>);"><i class="fa fa-trash"></i><?php echo $lang['nc_del'];?></a>
                                        <a href="JavaScript:show_recommend_dialog(<?php echo $key;?>);"><i class="fa fa-shopping-cart"></i>商品块</a>
                                    </dt>
                                    <dd>
                                        <?php if(!empty($val['goods_list']) && is_array($val['goods_list'])) { ?>
                                            <ul class="goods-list goods-list01">
                                                <?php foreach($val['goods_list'] as $k => $v) { ?>
                                                    <li><span><a href="javascript:void(0);"> <img title="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>"/></a></span> </li>
                                                <?php } ?>
                                            </ul>
                                        <?php } ?>

                                    </dd>
                                </dl>
                            <?php } ?>
                        <?php } ?>
                        <div class="add-tab" id="btn_add_list"><a href="JavaScript:add_recommend();"><i class="icon-plus-sign-alt"></i>新增商品模块</a>(最多9个)</div>

                    </div>
                </div>
            </dd>
        </dl>
    </div>
    <div class="ncap-form-default">
        <div class="bot">
            <a href="index.php?act=web_config&op=html_update&web_id=<?php echo $_GET['web_id'];?>" class="ncap-btn-big ncap-btn-green"><?php echo $lang['web_config_web_html']; ?></a>
        </div>
    </div>
</div>
<!-- 商品推荐模块 -->
<div id="recommend_list_dialog" style="display:none;">
    <div class="s-tips"><i></i>小提示：单击查询出的商品选中，双击已选择的可以删除，保存后生效。</div>
    <form id="recommend_list_form">
        <input type="hidden" name="web_id" value="<?php echo $output['code_recommend_list']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_recommend_list']['code_id'];?>">
        <div id="recommend_input_list" style="display:none;"><!-- 推荐拖动排序 --></div>
        <?php if (is_array($output['code_recommend_list']['code_info']) && !empty($output['code_recommend_list']['code_info'])) { ?>
            <?php foreach ($output['code_recommend_list']['code_info'] as $key => $val) { ?>
                <div class="ncap-form-default" select_recommend_id="<?php echo $key;?>">
                    <dl class="row">
                        <dt class="tit">商品模块标题名称</dt>
                        <dd class="opt">
                            <input name="recommend_list[<?php echo $key;?>][recommend][name]" value="<?php echo $val['recommend']['name'];?>" type="text" class="input-txt">
                            <p class="notic"><?php echo $lang['web_config_recommend_tips'];?></p>
                        </dd>
                    </dl>
                </div>
                <div class="ncap-form-all" select_recommend_id="<?php echo $key;?>">
                    <dl class="row">
                        <dt class="tit">已选商品</dt>
                        <dd class="opt">
                            <ul class="dialog-goodslist-s1 goods-list">
                                <?php if(!empty($val['goods_list']) && is_array($val['goods_list'])) { ?>
                                    <?php foreach($val['goods_list'] as $k => $v) { ?>
                                        <li id="select_recommend_<?php echo $key;?>_goods_<?php echo $k;?>">
                                            <div ondblclick="del_recommend_goods(<?php echo $v['goods_id'];?>);" class="goods-pic"> <span class="ac-ico" onclick="del_recommend_goods(<?php echo $v['goods_id'];?>);"></span> <span class="thumb size-72x72"><i></i><img select_goods_id="<?php echo $v['goods_id'];?>" title="<?php echo $v['goods_name'];?>" goods_name="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>" onload="javascript:DrawImage(this,72,72);" /></span></div>
                                            <div class="goods-name"><a href="<?php echo SHOP_SITE_URL."/index.php?act=goods&goods_id=".$v['goods_id'];?>" target="_blank"><?php echo $v['goods_name'];?></a></div>
                                            <input name="recommend_list[<?php echo $key;?>][goods_list][<?php echo $v['goods_id'];?>][goods_id]" value="<?php echo $v['goods_id'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo $key;?>][goods_list][<?php echo $v['goods_id'];?>][market_price]" value="<?php echo $v['market_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo $key;?>][goods_list][<?php echo $v['goods_id'];?>][goods_name]" value="<?php echo $v['goods_name'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo $key;?>][goods_list][<?php echo $v['goods_id'];?>][goods_price]" value="<?php echo $v['goods_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo $key;?>][goods_list][<?php echo $v['goods_id'];?>][goods_pic]" value="<?php echo $v['goods_pic'];?>" type="hidden">
                                        </li>
                                    <?php } ?>
                                <?php } ?>

                            </ul>
                        </dd>
                    </dl>
                </div>
            <?php } ?>
        <?php } ?>
        <div id="add_recommend_list" style="display:none;"></div>
        <div class="ncap-form-all">
            <dl class="row">
                <dt class="tit">选择要展示的商品</dt>
                <dd class="opt">
                    <div class="search-bar">
                        <label id="recommend_gcategory">商品分类
                            <input type="hidden" id="cate_id" name="cate_id" value="0" class="mls_id" />
                            <input type="hidden" id="cate_name" name="cate_name" value="" class="mls_names" />
                            <select>
                                <option value="0"><?php echo $lang['nc_please_choose'];?></option>
                                <?php if(!empty($output['goods_class']) && is_array($output['goods_class'])) { ?>
                                    <?php foreach($output['goods_class'] as $k => $v) { ?>
                                        <option value="<?php echo $v['gc_id'];?>"><?php echo $v['gc_name'];?></option>
                                    <?php } ?>
                                <?php } ?>
                            </select>
                        </label>
                        <input type="text" value="" name="recommend_goods_name" id="recommend_goods_name" placeholder="输入商品名称或SKU编号" class="txt w150">
                        <a href="JavaScript:void(0);" onclick="get_recommend_goods();" class="ncap-btn"><?php echo $lang['nc_query'];?></a></div>
                    <div id="show_recommend_goods_list" class="show-recommend-goods-list"></div>
                </dd>
            </dl>
        </div>
        <div class="bot"><a href="JavaScript:void(0);" onclick="update_recommend();" class="ncap-btn-big ncap-btn-green"><span><?php echo $lang['web_config_save'];?></span></a></div>
    </form>
</div>
<iframe style="display:none;" src="" name="upload_pic"></iframe>
<script src="<?php echo ADMIN_RESOURCE_URL;?>/js/jquery.ajaxContent.pack.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/common_select.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/waypoints.js"></script>
<script src="<?php echo ADMIN_RESOURCE_URL?>/js/web_index_fl.js"></script>